package com.hsjk.szwj.module.pay.dal.dataobject.config;

import com.hsjk.szwj.module.pay.dal.dataobject.system.MchAppDO;
import com.hsjk.szwj.module.pay.dal.dataobject.system.MchInfoDO;
import lombok.Data;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author chenjiawei
 * @desc 商户配置信息 放置到内存， 避免多次查询操作
 * @Date 2023/08/20 22:13
 **/
@Data
public class MchInfoConfigContext {
    /**
     * 商户信息缓存
     */
    private Long mchId;
    private Integer mchType;
    private MchInfoDO mchInfo;
    private Map<Long, MchAppDO> appMap = new ConcurrentHashMap<>();

    /**
     * 重置商户APP
     **/
    public void putMchApp(MchAppDO mchApp) {
        appMap.put(mchApp.getId(), mchApp);
    }

    /**
     * get商户APP
     **/
    public MchAppDO getMchApp(Long appId) {
        return appMap.get(appId);
    }
}
